package com.qidian.mes.pro.controller;

import com.qidian.mes.pojo.ProcessStep;
import com.qidian.mes.pro.service.StepService;
import com.qidian.mes.util.dot.PagerDTO;
import com.qidian.mes.util.pojo.QdResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author dqy
 * @Description
 * @Time 2024/4/9 15:45
 */
@RestController
@RequestMapping("/step")
@CrossOrigin
public class StepController {
    @Autowired
    private StepService stepService;
    @RequestMapping("/queryById")
    public QdResult<ProcessStep> queryById(Long processStepId)
    {
        return stepService.queryById(processStepId);
    }
    @RequestMapping("/saveStep")
    public QdResult saveStep(@RequestBody ProcessStep processStep)
    {
        return stepService.saveStep(processStep);
    }
    @RequestMapping("/updateStep")
    public QdResult updateStep(@RequestBody ProcessStep processStep)
    {
        return stepService.updateStep(processStep);
    }
    @RequestMapping("/delete")
    public QdResult deleteById(Long processStepId)
    {
        return stepService.deleteById(processStepId);
    }
    @RequestMapping("/deletes")
    public QdResult deletes(Long [] processStepIds)
    {
        return stepService.deletes(processStepIds);
    }
    @RequestMapping("/queryByPage")
    public QdResult<PagerDTO<ProcessStep> >queryByPage(Long processId, @RequestParam(defaultValue = "1") int start, @RequestParam(defaultValue = "5") int limit)
    {
        return stepService.queryByPage(processId,start,limit);
    }
}
